package com.rodagroup.study.modules.svc.provider.service;

import org.apache.dubbo.demo.DemoService;
import org.apache.dubbo.demo.HelloReply;
import org.apache.dubbo.demo.HelloRequest;

import java.util.concurrent.CompletableFuture;

/**
 * @author jake, {@literal <jake.kim@rodagroup.cn>}
 * @date 2022-07-24.
 */
public class DemoServiceImpl implements DemoService {

  public HelloReply sayHello(HelloRequest request) {
    String name = request.getName();
    HelloReply reply = HelloReply.newBuilder()
        .setMessage("hello reply: " + name)
        .build();
    return reply;
  }

  public CompletableFuture<HelloReply> sayHelloAsync(HelloRequest request) {
    String name = request.getName();
    HelloReply reply = HelloReply.newBuilder()
        .setMessage("hello reply: " + name)
        .build();
    return CompletableFuture.completedFuture(reply);
  }

}
